import { createApp } from "vue";
// import './style.css'
import App from "./App.vue";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";

import router from "./router/index";
import "normalize.css";

import { createPinia } from "pinia";

import piniaPluginPersist from "pinia-plugin-persist";

const pinia = createPinia();
pinia.use(piniaPluginPersist);

//懒加载组件
function loadComponent(url) {
  //使用vite懒加载
  let Module = import.meta.glob("@/pages/**/*.vue");
  let path = Module[`/src/pages${url}/index.vue`];
  return path;
}

import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { vDraggable } from "./untils/move";

import i18n from "@/i18n/index.js";
// import globalComponen from '@/components/index.js'

import installPlugins from "@/plugins/plugins.js";

const app = createApp(App);


vDraggable(app);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// app.use(globalComponen);
app.use(installPlugins);
app.use(ElementPlus);
app.use(i18n);
app.use(router);
app.use(pinia);
app.mount("#app");
